1. Field of the Invention
The present invention relates to a flash memory writing method and, more particularly, to a method of writing data from an external apparatus in a flash memory.
2. Description of the Prior Art
A flash memory is a nonvolatile memory in which memory contents can be electrically erased or written. The flash memory is widely used as a memory for storing the program of an apparatus having a microprocessor because of a relatively low cost and a large capacity.
Operating the microprocessor requires an initial program loader (to be referred to as an IPL hereinafter). When the flash memory is used as a program memory, the IPL must be written therein before mounting on a board. The IPL is written using a memory writer corresponding to each chip of the flash memory.
When the memory contents of the flash memory are to be rewritten due to the presence of a bug in the IPL, or the like, the flash memory is first dismounted from the board, its memory contents are erased, and then memory contents are rewritten using the memory writer again. Write (rewrite) of a program in the flash memory leads to large work cost.
To reduce the work cost of program write in the flash memory, in one method an EPROM storing the IPL is arranged in addition to the flash memory, an address space for the IPL is assigned to the EPROM, and the remaining address space is assigned to the flash memory.
However, since this method uses the EPROM in addition to the large-capacity flash memory capable of providing a sufficient memory space, the part and manufacturing costs are wasted. Rewrite of the IPL itself requires works such as detachment of the EPROM from the board, ultraviolet erasing of the memory contents, data write, and attachment of the EPROM, resulting in large work cost.
In view of this problem, Japanese Unexamined Patent Publication No. 4-235632 discloses a "program loading method". According to this method, an external apparatus storing an IPL is connected via a bus to an apparatus having a microprocessor, and an IPL address space is assigned to a memory in the external apparatus.
This "program loading method" will be described below.
FIG. 1 is a block diagram showing the arrangement of hardware to which the "program loading method" is applied.
FIGS. 2A, 2B, and 2C are views, respectively, for explaining an example of assignment of the address space in the "program loading method".
In the hardware arrangement shown in FIG. 1, an inverter 55 outputs a memory card presence/absence signal depending on whether a memory card 53 with an EPROM storing an IPL is connected. A memory controller 54 receives a memory card presence/absence signal 57, and outputs either one of chip enable signals 58 and 59 in normal operation. For example, when no memory card is connected, an IPL address space A is assigned to a flash memory (FMEM) 52, as shown in FIG. 2A; when the memory card 53 is connected, the IPL address space A is assigned to an EPROM 53a in the memory card 53, as shown in FIG. 2B. If the memory card 53 is connected, a microprocessor 51 can start the IPL in the EPROM 53a to execute the program.
When information stored in the EPROM 53a is written (copied) in the flash memory 52, the memory controller 54 outputs both the chip enable signals 58 and 59. For example, the address space A is assigned to the EPROM 53a in the memory card 53, whereas an address space B (area not overlapping the address space A) is assigned to the flash memory (FMEM) 52, as shown in FIG. 2C. The microprocessor 51 first erases the memory contents of the flash memory 52, then reads out the IPL in the address space A, and stores it in the address space B. In this manner, write (rewrite) of the IPL in the flash memory 52 can be performed.
This method, however, can be employed only when data to be copied from the EPROM 53a in the memory card 53 to the flash memory 52 occupies 1/2 or less the whole address space. This is because the address spaces of copy source and destination may not overlap each other. Therefore, when the data to be copied occupies more than 1/2 the whole address space, the data of the EPROM in the memory card 53 is divided. The divided data are temporarily copied in a RAM 56, and copied from the RAM 56 to the flash memory 52. This method using the RAM 56 as a work area is indirect copying in which the same contents must be copied twice, requiring a processing time about twice that of direct copying. In this method, two programs must be prepared in accordance with the data amount to be copied.